<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>贪吃蛇游戏 - PixiJS版本</title>
    <!-- 引入PixiJS库 -->
    <script src="https://cdn.jsdelivr.net/npm/pixi.js@7.x/dist/pixi.min.js"></script>
    <style>
        body {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
            margin: 0;
            background-color: #f0f0f0;
            font-family: Arial, sans-serif;
            overflow: hidden; /* 防止页面滚动 */
        }
        .game-container {
            position: relative;
            width: 500px;
            height: 500px;
        }
        #game-board {
            width: 100%;
            height: 100%;
            background-color: #fff;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        #game-board canvas {
            display: block;
        }
        .score-panel {
            margin-top: 20px;
            font-size: 24px;
            font-weight: bold;
            display: flex;
            align-items: center;
            gap: 20px;
        }
        .level-select {
            font-size: 18px;
        }
        .game-over {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background-color: rgba(0, 0, 0, 0.8);
            color: white;
            padding: 20px;
            border-radius: 10px;
            text-align: center;
            display: none;
        }
        .game-over button {
            background-color: #4CAF50;
            border: none;
            color: white;
            padding: 10px 20px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 16px;
            margin-top: 10px;
            cursor: pointer;
            border-radius: 5px;
        }
        .controls {
            margin-top: 10px;
            display: flex;
            gap: 10px;
            align-items: center;
        }
    </style>
</head>
<body>
    <div class="game-container">
        <div id="game-board"></div>
        <div id="game-over" class="game-over">
            <h2>游戏结束!</h2>
            <p>你的得分: <span id="final-score">0</span></p>
            <button id="restart-button">重新开始</button>
        </div>
    </div>
    <div class="score-panel">
        <div>得分: <span id="score">0</span></div>
        <div class="controls">
            <label for="level-select">关卡:</label>
            <select id="level-select" class="level-select">
                <option value="1">第1关</option>
                <option value="2">第2关</option>
                <option value="3">第3关</option>
                <option value="4">第4关</option>
                <option value="5">第5关</option>
            </select>
        </div>
    </div>

    <script src="game.js"></script>
</body>
</html>